package com.dr.cmdb.core.service.impl;

import com.dr.cmdb.core.domain.Tables;
import com.dr.cmdb.core.dto.TableModelsDto;
import com.dr.cmdb.core.mapper.TablesMapper;
import com.dr.cmdb.core.mapper.TablesModelMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

import com.dr.cmdb.core.service.TablesService;

import java.util.List;

/**
      * @ProjectName:    cmdb
      * @Package:        com.dr.cmdb.application.service
      * @Description:     java类作用描述 
      * @Author:            duanrui
      * @CreateDate:     2021/3/16 19:42
      * @Version:        1.0
      * 
Copyright: Copyright (c) 2021

* */
@Service
public class TablesServiceImpl implements TablesService{

    @Resource
    private TablesMapper tablesMapper;

    @Resource
    private TablesModelMapper tablesModelMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return tablesMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertSelective(Tables record) {
        return tablesMapper.insertSelective(record);
    }

    @Override
    public Tables selectByPrimaryKey(Integer id) {
        return tablesMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Tables record) {
        return tablesMapper.updateByPrimaryKeySelective(record);
    }

    /**
     * 获取表字段
     *
     * @param tableName
     * @return
     */
    @Override
    public List<TableModelsDto> getTableCols(String tableName) {
        return tablesModelMapper.selectByTableName(tableName);
    }
}
